import http from '@/utils/api/index'

export const filterCategory = async (params = {}) => {
  let res = await http.get('/system/article/list', {
    params
  })
  return res.data.rows
}
export const filterArticleItem = async (CategoryId = '', params = {}) => {
  let res = await http.get(`/system/articleitem/list`, {
    params: {
      articleClassifyId: CategoryId,
      ...params
    }
  })
  return res
}
export const ArticleSummaryByCategory = async (CategoryId) => {
  let res = await filterArticleItem(CategoryId, {
    pageNumber: 1,
    pageSize: 0
  })
  return res.data.total
}

export const getpresentationCategory = async () => {
  let data = await filterCategory({
    presentation: 1
  })
  return data || []
}

export const getArciclePresentation = async () => {
  let data = await filterArticleItem('', {
    status: 2
  })
  return data.data.rows || []
}

export const getArticleDetail = async (id) => {
  let res = await http.get(`/system/articleitem/${id}`)
  return res.data.data
}
